Lossless compression makes use of the statistical redundancy of data. Compared with lossy compression, lossless compression recovers original data exactly without any distortion. The common compression software such as WinZip and WinRAR is based on the lossless compression technology. With the increase of user demand for high-definition media, the lossless compression technology is increasingly applied to audio and video coding.
Taking audio coding as an example, in the prior art, a common solution to audio coding is dynamic range coding. That is, the coding is performed according to the difference between the maximum sample value and the minimum sample value of each data frame (that is, data block) in the audio signal. The basic process is as follows: Analyze an input signal to obtain all the values of the samples of the input signal; calculate the dynamic range of data frame n (framen), namely, the difference between the maximum sample value and the minimum sample value in this data frame; then determine the number of bits (bn) required for coding the samples of this data frame according to the dynamic range. In the coding, use bn, bits to encode the difference between each sample value and the minimum value in framen; and finally, multiplex the coding values of all the samples of framen and the minimum sample value of the data as the coding output of the data frame.
The prior art has at least these defects: In the foregoing dynamic range coding scheme, when the dynamic range of the data frame is small, a great compression ratio can be obtained; but if the dynamic range of the data frame is great, a large number of bits need to be used for coding for each sample of the frame, which affects the compression efficiency.